
import {CommonIp} from "../../user/entity/Ip";
import {Component} from "@angular/core";
import {Router} from "@angular/router";
@Component({
  selector:'nav-right',
  templateUrl:'./nav-right.html',
})
export  class NavRightComponent extends CommonIp
{
  public constructor(private router: Router){
  super();
  }
  isLogins(number:number){
    if(this.UserIsLogin()==null){
      this.HiddenLeftProgram();
      this.router.navigate(['/isLogin']);
      return;
    }else {
      if(number==1){
        this.router.navigate(['/personalUpdateMessage']);
        return;
      }
      if(number==2){
        sessionStorage.setItem("personInfoId",sessionStorage.getItem("id"));
        this.router.navigate(['/personal/personalFollow/',{id:sessionStorage.getItem("personInfoId"), pageNo: 0}]);
        return;
      }
      if(number==3){
        this.HiddenLeftProgram();
        sessionStorage.removeItem("email");
        sessionStorage.removeItem("name");
        sessionStorage.removeItem("id");
        sessionStorage.removeItem("userimg");

        this.router.navigate(['/isLogin']);
        return;
      }
      if(number==4){
        this.router.navigate(['/feedback']);
      }
      if(number==5){
        this.router.navigate(['/project/add']);
      }
    }
  }
  public UserIsLogin  (){
    var email=sessionStorage.getItem("email");
    return email;
  }

}
